package com.tfy.liquor.controller;

import com.tfy.liquor.bean.Result;
import com.tfy.liquor.bean.UserPriseRecords;
import com.tfy.liquor.service.UserPriseRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/userPriseRecords")
public class UserPriseRecordsController {
    @Autowired
    private UserPriseRecordsService userPriseRecordsService;

    // 获取数据
    @RequestMapping("/getUserPriseRecords")
    public Result getUserPriseRecords(Integer pageNum, Integer pageSize, UserPriseRecords userPriseRecords) {
//        System.err.println(userPriseRecords);
        if (null != userPriseRecords) {
            if (null == userPriseRecords.getOrderId() || "".equals(userPriseRecords.getOrderId().trim())) {
                userPriseRecords.setOrderId(null);
            }
            if (null == userPriseRecords.getType() || "".equals(userPriseRecords.getType().trim())) {
                userPriseRecords.setType(null);
            }
            if (null == userPriseRecords.getRemark() || "".equals(userPriseRecords.getRemark().trim())) {
                userPriseRecords.setRemark(null);
            }
        } else {
            return new Result().bad_CodeIsNull();
        }
//        System.err.println(userPriseRecords);
        return new Result(userPriseRecordsService.getUserPriseRecords(pageNum, pageSize, userPriseRecords)).ok();
    }
}
